package com.zzyl.controller;

import com.zzyl.base.ResponseResult;
import com.zzyl.dto.AlertDataHandleDto;
import com.zzyl.entity.AlertData;
import com.zzyl.mapper.AlertDataMapper;
import com.zzyl.service.AlertDataService;
import com.zzyl.vo.AlertDataVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/alert-data")
@Api(tags = "报警数据")
public class AlertDataController extends BaseController {
    @Autowired
    private AlertDataService alertDataService;

    //分页查询
    @GetMapping("/pageQuery")
    public ResponseResult<AlertDataVo> page(Integer pageNum,
                                            Integer pageSize,
                                            String deviceName,
                                            Long endTime,
                                            Long startTime,
                                            Integer id,
                                            Integer status) {
        return success(alertDataService.pageQuery(pageNum, pageSize, deviceName, endTime, startTime, id, status));
    }

    @PutMapping("/handleAlertData/{id}")
    public ResponseResult handleAlertData(@PathVariable("id") Long id, @RequestBody AlertDataHandleDto alertDataHandleDto) {
        alertDataService.handleAlertData(id, alertDataHandleDto);
        return success();
    }
}
